/**
 * Created by widthdrawnm on 16/10/2.
 */
import React, { Component } from 'react';

export default class Checkbox extends Component {
    constructor(props) {
        super(props);
        this.state={checked:this.props.checked};
    }

    clickFunc(e){
        this.setState({checked:!this.state.checked});
        this.props.onChange(e);
    }


    render(){
        return (
            <span>
                    <input type="checkbox" checked={this.state.checked} onChange={this.clickFunc.bind(this)} />
            </span>
        )
    }
}
Checkbox.defaultProps = {
    checked:true,
};

